<?php
require("dbcon.php");
$id=(isset($_GET['id']))?$_GET['id']:0;
if(empty($_POST)){
$sql="select * from t_message where id='$id'";
$kis=$db->query($sql);
$edis=$kis->fetch_array();
include "edis_index.php";
    }else{
        $username=$_REQUEST['username'];
        $message=$_REQUEST['message'];
        $sex=$_REQUEST['sex'];
        $imgurl=$_REQUEST['imgurl'];
        $sql="update t_message set username='$username',message='$message',sex='$sex',imgurl='$imgurl' where id='$id'";
        $rs=$db->query($sql);
 if($rs==true){
     header("Location:index.php");
}else{
      echo "<script language='javascript'>";
           echo "alert('修改失败！');";
           echo "window.location.href='index.php';";
           echo "</script>";
}
    }
